Skip to content

Fix TypeScript compilation errors in notification and workflow hooks#27

Merged
hotlong merged 2 commits intomainfrom
copilot/fix-ci-deployment-issues
Feb 9, 2026
Merged

Fix TypeScript compilation errors in notification and workflow hooks#27
hotlong merged 2 commits intomainfrom
copilot/fix-ci-deployment-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 9, 2026

CI failing with 4 TypeScript errors: missing type exports and incorrect workflow reject signature.

Type Import Corrections

GetNotificationPreferencesResponse and UpdateNotificationPreferencesResponse are not re-exported by @objectstack/client. Changed to import from @objectstack/spec/api:

// hooks/useNotifications.ts
import type {
  GetNotificationPreferencesResponse,
  UpdateNotificationPreferencesResponse,
} from "@objectstack/spec/api";

Workflow Reject Signature

API spec requires reason parameter (not optional). Updated interface and implementation:

// Before
reject: (comment?: string) => Promise<WorkflowRejectResponse>

// After  
reject: (reason: string, comment?: string) => Promise<WorkflowRejectResponse>

Implementation now passes all required fields to client.workflow.reject():

await client.workflow.reject({
  object: objectName,
  recordId,
  reason,  // Required by API
  comment, // Optional
});

Test Updates

  • Updated notification preferences test type assertion to match actual return type
  • Updated workflow reject test expectation to pass reason field
Original prompt

引用: https://github.com/objectstack-ai/mobile/actions/runs/21828867914/job/62981165149#step:6:1


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Import GetNotificationPreferencesResponse and UpdateNotificationPreferencesResponse from @objectstack/spec/api instead of @objectstack/client
- Fix test type assertion for NotificationPreferences
- Add missing 'reason' parameter to workflow reject() method signature and implementation
- Update test expectations to match new reject() signature

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI deployment issues in mobile actions Fix TypeScript compilation errors in notification and workflow hooks Feb 9, 2026
Copilot AI requested a review from hotlong February 9, 2026 14:49
@hotlong hotlong marked this pull request as ready for review February 9, 2026 14:49
Copilot AI review requested due to automatic review settings February 9, 2026 14:49
@hotlong hotlong merged commit 0d72833 into main Feb 9, 2026
2 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CI TypeScript failures by aligning hook typings with the ObjectStack API spec—fixing missing type exports for notifications preferences and updating the workflow reject signature to require a reason.

Changes:

  • Import notification preference response types from @objectstack/spec/api instead of @objectstack/client.
  • Update useWorkflowState().reject to require a reason parameter and pass it through to client.workflow.reject.
  • Adjust related tests to match updated typings / request shapes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
hooks/useWorkflowState.ts Updates the hook’s reject signature and request payload to include required reason.
hooks/useNotifications.ts Switches preference response type imports to @objectstack/spec/api.
tests/hooks/useWorkflowState.test.ts Updates reject test to pass/expect reason.
tests/hooks/useNotifications.test.ts Updates preference test typing to match the hook return type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 172 to 176
expect(mockReject).toHaveBeenCalledWith({
object: "tasks",
recordId: "rec-1",
comment: "Needs changes",
reason: "Needs changes",
});
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expectation will fail because the hook calls client.workflow.reject({ object, recordId, reason, comment }), so the argument object includes a comment key (as undefined when omitted). Update the assertion to either include comment: undefined or use a partial matcher (e.g., expect.objectContaining) so it matches the actual call shape.

Copilot uses AI. Check for mistakes.
Comment thread hooks/useNotifications.ts
Comment on lines 3 to +10
import type {
ListNotificationsResponse,
RegisterDeviceResponse,
} from "@objectstack/client";
import type {
GetNotificationPreferencesResponse,
UpdateNotificationPreferencesResponse,
} from "@objectstack/client";
} from "@objectstack/spec/api";
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@objectstack/spec/api is now a direct import. @objectstack/spec is not listed in package.json dependencies (only present via pnpm-lock as a transitive dep), so this can become brittle if the client package ever stops depending on it. Add @objectstack/spec as an explicit dependency (or switch to a type source that’s already a direct dependency) to keep installs/builds stable.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants